package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.CampusContact;
import com.ruoyi.system.mapper.CampusContactMapper;
import com.ruoyi.system.service.CampusContactService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class CampusContactServiceImpl implements CampusContactService {
    @Autowired
    private CampusContactMapper contactMapper;

    @Override
    public List<CampusContact> listByCampusId(Long campusId) {
        return contactMapper.selectByCampusId(campusId);
    }

    @Override
    public CampusContact getById(Long id) {
        return contactMapper.selectById(id);
    }

    @Override
    @Transactional
    public int save(CampusContact contact) {
        return contactMapper.insert(contact);
    }

    @Override
    @Transactional
    public int update(CampusContact contact) {
        return contactMapper.update(contact);
    }

    @Override
    @Transactional
    public int deleteByCampusId(Long id) {
        return contactMapper.deleteByCampusId(id);
    }
}
